package lumis.portal.deployment;

import java.io.PrintWriter;
import java.io.StringWriter;

/**
 * Represents an error entry in the module deployment process.
 * 
 * @version $Revision: 13093 $ $Date: 2011-05-28 18:40:18 -0300 (Sat, 28 May 2011) $
 * @since 6.0.0
 */
class ModuleErrorEntry
{
	private String title;
	private String detail;
	
	ModuleErrorEntry(String title, Exception e)
	{
		String stackTrace = ModuleErrorEntry.getStackTrace(e);
		this.title = title;
		this.detail = stackTrace;
	}	
	
	public String getTitle()
	{
		return title;
	}
	public void setTitle(String title)
	{
		this.title = title;
	}
	
	public String getDetail()
	{
		return detail;
	}
	public void setDetail(String detail)
	{
		this.detail = detail;
	}
	
	private static String getStackTrace(Throwable t)
    {
        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw, true);
        t.printStackTrace(pw);
        pw.flush();
        sw.flush();
        return sw.toString();
    }
}